import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
// import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    //主界面
    {
      path: "/",
      redirect: "/indexs",
    },
    {
      path: '/indexs',
      name: 'indexs',
      component: () => import('../view/indexs.vue'),
    }, 
    // 横截面温度场
    {
      path: '/hjm',
      name: 'hjm',
      component: () => import('../view/hjm.vue'),
    }, 

    // 燃烧稳定性检测
    {
      path: '/ranshaowendingxing',
      name: 'ranshaowendingxing',
      component: () => import('../view/ranshaowendingxing.vue'),
    }, 
    // 煤粉分配律
    {
      path: '/meifen',
      name: 'meifen',
      component: () => import('../view/meifen.vue'),
    }, 
    // 预警信息
    {
      path: '/yujing',
      name: 'yujing',
      component: () => import('../view/yujing.vue'),
    }, 
    // 参数设置
    {
      path: '/_shuzhicanshe_huaian_.',
      name: '_shuzhicanshe_huaian_.',
      component: () => import('../view/_shuzhicanshe_huaian.vue'),
    }, 
    {
      path: '/_shuzhicanshe_huaiandiejia_',
      name: '_shuzhicanshe_huaiandiejia_',
      component: () => import('../view/_shuzhicanshe_huaiandiejia_.vue'),
    }, 
    {
      path: '/kaiguanliang',
      name: 'kaiguanliang',
      component: () => import('../view/kaiguanliang.vue'),
    },
    // 历史数据查询
    {
      path: '/history',
      name: 'history',
      component: () => import('../view/history.vue'),
    }, 
    {
      path: '/history0',
      name: 'history0',
      component: () => import('../view/history0.vue'),
    }, 
    {
      path: '/lutangwenduchang',
      name: 'lutangwenduchang',
      component: () => import('../view/lutangwenduchang.vue'),
    }, 
    // 练习的 demo
    {
      path: '/demo',
      name: 'demo',
      component: () => import('../view/demo.vue'),
    }, 
    {
      path: '/demo1',
      name: 'demo1',
      component: () => import('../view/demo1.vue'),
    }, 
  ]
})

router.beforeEach((to, from, next) => {
  // 在跳转前判断页面是否有缓存，如果有则清除
  if (to.meta.clearCache) {
    sessionStorage.clear()
  }
  next()
})

export default router
